<template>
	<div class="main" style="background: #fff;">
		<div style="width: 7.5rem;height: 100vh;background: #fff;">
			<scroller>
				<div class="adOuterWrap flex-h">
					<div class="back">
						<go-back aa='../teachers/teaindex'></go-back>
						<h2 @click="commonJs.gosto('../teachers/teaindex')">智能志愿填报方案</h2>
					</div>
					<div class="adWrap">
						<div class="adBoxs">
						</div>


					</div>
					<div class="adBot">
						<span @click="gotos">开始填报</span>
					</div>
				</div>
			</scroller>
		</div>
	</div>
</template>
<script>
	import ls from 'store2';
	import axios1 from '~/plugins/axios1'

	import {
		format
	} from '~/plugins/filter';
	import goBack from '~/components/goBack'
	export default {
		head: {
			title: '志愿填报'
		},
		components: {
			goBack
		},
		data() {
			return {
				showNext: false,
				userType: ls.get('userData').userType,
			}
		},
		created() {
			this.commonJs.gologins();
		},
		mounted: function() {

			// this.showKaosheng()
			this.showListJilu()
			if (this.commonJs.isTerminal() == 'isAndroid') {
				if (window.history && window.history.pushState) {
					history.pushState(null, null, document.URL);
					window.addEventListener('popstate', this.fun, false); //false阻止默认事件 
				}
			}
		},
		destroyed() {
			// this.commonJs.xahui('../teachers/teaindex')
			window.removeEventListener('popstate', this.fun, false); //false阻止默认事件
		},
		watch: {

		},

		methods: {
			showListJilu() {
				axios1.posts('/volunteer/getBalanceRecord?userType='+this.userType, {					
				}).then(res => {
				 
					if (res.code == '0') {
						if(res.data){
							ls.set('caseData1',res.data.balance)
							ls.set('caseData2',res.data.academy)
							ls.set('caseData3',res.data.major)
						}
						
					}
				}).catch((error) => {
					this.$vux.toast.text(error);
				})
			},
			fun() {
				this.$router.replace({
					path: '../teachers/teaindex'

				})

			},
			showKaosheng() {
				axios1.post('/volunteer/getExaminee', {
					userType: this.userType
				}).then(res => {
					if (res.message == '用户未登录,请重新登录') {
						console.log(111)
						this.goto('../teachers/tealogin')
						return false;
					}
					if (res.code == '0') {
						if (res.data == 0) {
							this.showNext = true
						}
					}
				}).catch((error) => {
					this.$vux.toast.text(error);
				})
			},
			gotos() {
		
				if (ls.get('caseData1')) {
					ls.set('preUrl', 'indexs')
					this.commonJs.gosto('programme')
					// this.goto('stepTwo')
				} else {
					this.commonJs.gosto('stepOne')
				}
			},
			goto(routerName, queryData) {

				this.$router.replace({
					path: routerName,
					query: {
						type: queryData
					}
				});
			},

		},
		beforeDestroy() {

		}

	}
</script>

<style scoped lang="less">
	.adOuterWrap {
		width: 7.5rem;
		height: 100vh;
		background: #fff;
		flex-direction: column;
		overflow: hidden;

		.adWrap {
			flex: 1;
			padding: 0 0.3rem;
			width: 7.5rem;
			box-sizing: border-box;

			.adBoxs {
				width: 100%;
				height: 100%;

				background: url('~/static/images/zybj.png') no-repeat;
				background-size: 100% 100%;

				img {
					display: block;
					border: none;
					width: 100%;
					height: 100%;
				}
			}
		}

		.adBot {
			span {
				display: block;
				width: 3.2rem;
				height: 0.88rem;
				background: linear-gradient(45deg, rgba(103, 189, 25, 1) 0%, rgba(181, 232, 97, 1) 100%);
				border-radius: 0.44rem;
				font-size: 0.36rem;

				font-weight: 600;
				color: rgba(255, 255, 255, 1);
				line-height: 0.88rem;
				text-align: center;
				margin: 0.2rem auto 0.3rem;

			}
		}
	}

	.back {
		width: 100%;
		height: auto;

		h2 {
			padding: 0 0.3rem;
			box-sizing: border-box;
			display: block;
			height: 0.8rem;
			font-size: 0.44rem;

			font-weight: bold;
			color: rgba(34, 34, 34, 1);
			line-height: 0.8rem;
		}
	}
</style>
